#include <bits/stdc++.h>
#define v vector
using namespace std;
int balancedStringSplit(string s)
{
    int nums = 0, len = s.size(), i = 0, n = 0;
    ;
    while (i != len)
    {
        if (s[i] == 'R')
        {
            n++;
        }
        if (s[i] == 'L')
        {
            n--;
        }
        if (n == 0)
        {
            nums++;
        }
        i++;
    }
    return nums;
}
int main()
{
    cout << balancedStringSplit("LLRR") << endl;
    return 0;
}